<template lang="pug">
    skin(@up="up",@down="down",@yes="yes",@back="back",@duringUp="up",@duringDown="down")
        div(class="flex-column exhaust-history h3")
            div(class="flex-column-item flex-center-center")
              span -----日总量回顾----
            div(class="flex-column-item flex-row" v-for="item in currentPageMenus")
                div(class="flex-row-item") {{item.date}}
                div(class="flex-row-item center") >
                div(class="flex-row-item right") {{item.amount}}
                div(class="flex-row-item center") u
                div(class="flex-row-item")
            div(class="flex-column-item",:class="'flex-'+(3-currentPageMenus.length)")

</template>

<script>
export default {
  data() {
    return {
      items: [
        { date: "0303", amount: "22.2", index:"01"},
        { date: "0304", amount: "24.4", index:"02"},
        { date: "0305", amount: "25.5", index:"03"},
        { date: "0306", amount: "26.7", index:"04"},
        { date: "0307", amount: "22.8", index:"05"},
        { date: "0308", amount: "32.9", index:"06"},
        { date: "0309", amount: "22.9", index:"07"},
        { date: "0310", amount: "32.9", index:"08"},
        { date: "0311", amount: "22.9", index:"09"},
        { date: "0312", amount: "32.6", index:"10"},
        { date: "0313", amount: "12.3", index:"11"},
      ].reverse(),
      page: { pageIndex: 1, pageSize: 3 }
    };
  },
  computed: {
    currentPageMenus() {
      var start = (this.page.pageIndex - 1) * this.page.pageSize;
      var end = start + this.page.pageSize;
      return this.items.slice(start, end);
    },
    totalPage() {
      var zs = Math.round(this.items.length / this.page.pageSize);
      return this.items.length % this.page.pageSize == 0 ? zs : zs + 1;
    }
  },

  methods: {
    up() {
      this.page.pageIndex =
        this.page.pageIndex == 1 ? this.totalPage-1 : this.page.pageIndex - 1;
    },
    down() {
      this.page.pageIndex =
        this.page.pageIndex == this.totalPage-1 ? 1 : this.page.pageIndex + 1;
    },

    back() {
      this.$router.push("index?index=2");
    },
    yes() {}
  },
  created() {}
};
</script>

<style lang="less">
</style>
